((doc) => {
    let bg = doc.querySelector('.bg');

    const init = () => {
        bindEvent();
        return;
    };

    const bindEvent = () => {
        // 监听滚轮事件
        doc.addEventListener('scroll', () => handleDocScroll());
    };

    function handleDocScroll() {
        // 获取滚轮的位置
        const scrollY = window.scrollY;
        if (scrollY !== 0) {
            bg.style.backgroundPosition = `calc(80% + ${scrollY}px 80% + ${scrollY}px)`;
        } else {
            bg.style.backgroundPosition = ``;
        }
    }

    init();
})(document);
